package cn.com.dashboard.model;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页数据封装类
 *
 * @author jiaming
 */
@Data
public class CommonPage<T> implements Serializable {

    private Integer pageNum;
    private Integer pageSize;
    private Integer totalPage;
    private Long totalCount;
    private List<T> list;

    public static <T> CommonPage<T> restPage(List<T> list, Long total, Integer totalPage,
                                             Integer pageNum, Integer pageSize) {
        CommonPage<T> result = new CommonPage<>();
        result.setTotalPage(totalPage);
        result.setPageNum(pageNum);
        result.setPageSize(pageSize);
        result.setTotalCount(total);
        result.setList(list);
        return result;
    }

}
